function addBookValidator(form){
    
     var checkword = /^[A-Za-z0-9 ]{3,20}$/;
     var checkyear = /^[0-9]{4}$/;
     var checkauth = /^[A-Za-z0-9 ]{3,50}$/;
     var checksynopsis = /^[A-Za-z0-9., ]{20, 50}$/;
     var checkprice = /^[0-9]*\.?[0-9]{1,10}$/;
     var noError = true;
     
     if(!checkword.test(form.bookTitle.value)){
         document.getElementById("bookTitleError").innerHTML='Please enter a valid book title';
         noError = false;
     }else{
         document.getElementById("bookTitleError").innerHTML='';
     }
     
     if(!checkyear.test(form.bookYear.value)){
         document.getElementById("bookYearError").innerHTML='Please enter a valid book Year(e.g. 2004)';
         noError = false;
     }else{
         document.getElementById("bookYearError").innerHTML='';
     }
     
     if(!checkauth.test(form.bookAuthor.value)){
         document.getElementById("bookAuthorError").innerHTML='Please enter a valid Author name';
         noError = false;
     }else{
         document.getElementById("bookAuthorError").innerHTML='';
     }
     
     if(!checksynopsis.test(form.synopsis.value)){
         document.getElementById("synopsisError").innerHTML='Please enter a valid synopsis';
         noError = false;
     }else{
         document.getElementById("synopsisError").innerHTML='';
     }
     
     if(!checkprice.test(form.price.value)){
         document.getElementById("priceError").innerHTML='Please enter correct Price format (e.g. 100.00)';
         noError=false;
     }else{
         document.getElementById("priceError").innerHTML='';
     }
     return noError;
}


